Problem Note 63348: Incorrect results are returned when you use a WHERE clause in an SQL procedure to subset blanks
Incorrect results are returned when you subset blanks on a database management system (DBMS) table with a WHERE clause using the SQL procedure.
You encounter this issue when you run code that is similar to the following:
%let connOptions=DATABASE=test SERVER="verthost" PORT=5433;
%let userpw=user=user-ID password=pw123;
%let sysconnOptions=&userpw. &connOptions.;
%let tabName=zz;
%let engine=sasiovrt;
libname x &engine. &sysconnOptions. ;
%macro execQuery(query);
proc sql;
connect to &engine. (&sysconnOptions. );
execute(&query)by &engine.;
disconnect from &engine.;
quit;
%mend;
%execQuery(DROP TABLE &tabName.);
%execQuery(CREATE TABLE &tabName. ( "name" varchar(4) ));
%execQuery(insert into &tabName.( name) values ( 'test'));
%execQuery(insert into &tabName.( name) values ( ''));
%execQuery(insert into &tabName.( name) values ( ' '));
proc sql; select * from x.zz where name = ''; quit;
proc sql; select count(*) from x.zz where name = ''; quit;
There are two workarounds for this issue:
- Use the SQL pass-through facility to ensure that the DBMS handles processing.
- Add the is not null expression to WHERE clauses and ON clauses to ensure that you obtain the same result regardless of whether SAS or the DBMS does the processing.
Click the Hot Fix tab in this note to access the hot fix for this issue.
Operating System and Release Information
SAS System | SAS/ACCESS Interface to Vertica | Solaris for x64 | 9.4_M4 | 9.4_M5 | 9.4 TS1M4 | 9.4 TS1M5 |
Linux for x64 | 9.4_M4 | 9.4_M5 | 9.4 TS1M4 | 9.4 TS1M5 |
HP-UX IPF | 9.4_M4 | 9.4_M5 | 9.4 TS1M4 | 9.4 TS1M5 |
64-bit Enabled Solaris | 9.4_M4 | 9.4_M5 | 9.4 TS1M4 | 9.4 TS1M5 |
64-bit Enabled AIX | 9.4_M4 | 9.4_M5 | 9.4 TS1M4 | 9.4 TS1M5 |
Microsoft® Windows® for x64 | 9.4_M4 | 9.4_M5 | 9.4 TS1M4 | 9.4 TS1M5 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Problem Note |
Priority: | medium |
Date Modified: | 2019-01-03 13:45:14 |
Date Created: | 2018-12-09 05:03:45 |